/*
**  Copyright (C), CHENGDU GONGWEI TECHNOLOGY CO.,LTD.
**
**  Project:	Manager Unit v1.0
**  File:    	
**  Author: 	zhaozhuyu
**  Date:    	2017/05/20
**
**  Purpose:
**    		.
**
**  History: 
**  <author>   <time>          <version >   <desc>
*	$$Author$$
*/

#ifndef __NETOBJECT_H__
#define __NETOBJECT_H__

/* Include files. */
#include "standard.h"
#include "cplusplus.h"

/* Macro constant definitions. */

/* Type definitions. */

typedef enum {
	e_CLI = 1,
	e_CGI = 2,
	e_TR069 = 3,
	e_MAX = 4,
}e_net_object;

class subSystem;
class netObject 
{
public:
	netObject(u32 ip, u16 port, u32 fd);
	virtual ~netObject();
	int netRecv(int fd, u8 *buf, int len);
	int netSend(int fd, u8 *buf, int len);
	virtual int bind() = 0;
	virtual void accept() {};
	virtual int recvMsg() = 0;
	virtual int sendMsg() = 0;
	virtual int pushMsg(const char *msg);

public:

	u32					_ip;			
	u16 				_port;			
	u32					_fd;
	u32 				_id;
	subSystem 			*_sub;
	
#ifdef U_LOOP
	struct uloop_fd 	_h;
#else
	ev_io 				_h;
	struct ev_loop 		*_loop;
#endif

	string				_agent_name;
	queue<string> 		_out_queue;
	/*status*/
	
};

/* External variable declarations. */

/* External function declarations. */

/* Macro API definitions. */


#endif

